package cn.edu.nuaa.computer.utils;

import java.util.Objects;

public class TreeStack {
    private TreeStack leftNode;
    private TreeStack rightNode;
    private MyData data;

    public TreeStack() {
    }

    public TreeStack(MyData data) {
        this.data = data;
    }

    public TreeStack getLeftNode() {
        return leftNode;
    }

    public void setLeftNode(TreeStack leftNode) {
        this.leftNode = leftNode;
    }

    public TreeStack getRightNode() {
        return rightNode;
    }

    public void setRightNode(TreeStack rightNode) {
        this.rightNode = rightNode;
    }

    public MyData getData() {
        return data;
    }

    public void setData(MyData data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TreeStack treeStack = (TreeStack) o;
        return Objects.equals(leftNode, treeStack.leftNode) && Objects.equals(rightNode, treeStack.rightNode) && Objects.equals(data, treeStack.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(leftNode, rightNode, data);
    }

    @Override
    public String toString() {
        return "{" +
                "l=" + leftNode +
                ", r=" + rightNode +
                ", d=" + data +
                '}';
    }
}
